package com.acme.domain.bank;

import java.util.ArrayList;
import java.util.List;

import com.acme.domain.account.Account;
import com.acme.domain.account.CheckingAccount;
import com.acme.domain.account.SavingAccount;
import com.acme.domain.client.*;
import com.acme.exceptions.*;

public class BankApplication {
	private ArrayList<Bank> banks = new ArrayList<Bank>();
	
	public BankApplication() { }
	
	public static void main(String[] args) {
		Bank bank1 = new Bank(1);
		Client client1 = new Client("Vasya", Gender.MALE);
		Client client2 = new Client("Sveta", Gender.FEMALE);
		SavingAccount sAcc = new SavingAccount(111, 25.00);
		CheckingAccount chAcc = new CheckingAccount(211, 30.00, 15.00);
		client1.addAccount(sAcc);
		client2.addAccount(chAcc);
		
		try {
			BankService.addClient(bank1, client1);
			BankService.addClient(bank1, client2);
			BankService.addClient(bank1, client2);
		} catch(ClientExistsException ex) { 
			System.out.println(ex.getMessage()); 
		}
		
		try {
			sAcc.deposit(-1);
		} catch(IllegalArgumentException ex) {
			System.out.println(ex);
		}
		
		try {
			chAcc.deposit(-1);
		} catch(IllegalArgumentException ex) {
			System.out.println(ex);
		}
		
		try {
			sAcc.withdraw(30);
		} catch(NotEnoughFundsException ex) {
			System.out.println(ex.getMessage());
		}
		
		try {
			chAcc.withdraw(23);
		} catch(NotEnoughFundsException ex) {
			System.out.println(ex.getMessage());
		} catch (OverDraftLimitExceededException ex) {
			System.out.println(ex.getMessage());
		}
	}
}